package com.jf.cloud.product.controller.supplier;

import com.jf.cloud.common.response.ServerResponseEntity;
import com.jf.cloud.common.security.AuthUserContext;
import com.jf.cloud.product.service.SpuService;
import com.jf.cloud.product.vo.SpuCountVO;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zz
 * @date 2022/6/29 17:11
 */
@RestController("SpuStatisticsController")
@RequestMapping("/s/spu_statistics")
@Tag(name = "supplier-商品数据统计接口")
public class SpuStatisticsController {

    @Autowired
    private SpuService spuService;

    @GetMapping("/spu_count")
    @Operation(summary = "查询店铺各状态商品数量" , description = "根据商品状态统计商品数量")
    public ServerResponseEntity<SpuCountVO> getSpuCount() {
        SpuCountVO spuCountVO = spuService.getSpuCountBySupplierId(AuthUserContext.get().getTenantId());
        return ServerResponseEntity.success(spuCountVO);
    }

}
